import { FormSchema } from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
export const columns = [
  {
    title: '模板名称',
    dataIndex: 'ocrTemplateId',
    width: 150,
  },
  {
    title: '权重',
    dataIndex: 'weight',
    width: 300,
  },
  {
    title: '功能类型',
    dataIndex: 'featureType',
    width: 200,
    sorter: true,
    customRender: ({ text }) => {
      return render.renderDict(text, 'featureType');
    },
  },
  {
    title: '文字匹配规则',
    dataIndex: 'textFilterExpression',
    width: 200,
    sorter: true,
    customRender: ({ text }) => {
      return render.renderDict(text, 'textFilterExpression');
    },
  },
  {
    title: 'OCR识别文字',
    dataIndex: 'ocrText',
    width: 300,
  },
  {
    title: 'boxPoint',
    dataIndex: 'boxPoint',
    width: 300,
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    label: '模板名称',
    field: 'ocrTemplateId',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'ocrTemplateId',
      placeholder: '请选择模板名称',
      stringToNumber: true,
    },
    colProps: { span: 6 },
  },
  {
    label: '功能类型',
    field: 'featureType',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'featureType',
      placeholder: '请选择功能类型',
      stringToNumber: true,
    },
    colProps: { span: 6 },
  },
];
/**
 * 角色用户搜索form
 */
export const searchUserFormSchema: FormSchema[] = [
  {
    field: 'username',
    label: '用户账号',
    component: 'Input',
    colProps: { span: 12 },
    labelWidth: 74,
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: '',
    component: 'Input',
    show: false,
  },
  {
    label: '模板名称',
    field: 'ocrTemplateId',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'ocrTemplateId',
      placeholder: '请选择模板名称',
      stringToNumber: true,
    },
  },
  {
    label: '功能类型',
    field: 'featureType',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'featureType',
      placeholder: '请选择功能类型',
      stringToNumber: true,
    },
  },
  {
    label: '文字匹配规则',
    field: 'textFilterExpression',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'textFilterExpression',
      placeholder: '请选择功能类型',
      stringToNumber: true,
    },
  },
  {
    field: 'weight',
    component: 'InputNumber',
    label: '权重',
    required: true,
    colProps: {
      span: 8,
    },
    componentProps: {
      min: 1,
      max: 99,
    },
  },
  {
    field: 'ocrText',
    label: 'OCR识别文字',
    required: true,
    component: 'Input',
  },
  {
    field: 'boxPoint1',
    label: 'OCR左下坐标',
    required: true,
    component: 'Input',
  },
  {
    field: 'boxPoint2',
    label: 'OCR右下坐标',
    required: true,
    component: 'Input',
  },
  {
    field: 'boxPoint3',
    label: 'OCR右上坐标',
    required: true,
    component: 'Input',
  },
  {
    field: 'boxPoint4',
    label: 'OCR左上坐标',
    required: true,
    component: 'Input',
  },
];

export const formDescSchema = [
  {
    field: 'roleName',
    label: '角色名称',
  },
  {
    field: 'roleCode',
    label: '角色编码',
  },
  {
    label: '备注',
    field: 'description',
  },
];

export const modelFormSchema: FormSchema[] = [
  {
    label: 'APIkey',
    field: 'apiKey',
    component: 'Input',
    required: true,
    helpMessage: '请输入APIkey',
  },
];